# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:android)

platform :android do
  desc "Build APKs and rename with version number."
  lane :apk do
    verson_name = flutter_version()["version_name"];
    sh("flutter", "clean")
    sh("flutter", "build", "apk", "--split-per-abi")

    github_release = set_github_release(
      repository_name: "fastlane/fastlane",
      api_token: ENV["GITHUB_TOKEN"],
      name: "Super New actions",
      tag_name: verson_name,
      description: (File.read("changelog") rescue "No changelog provided"),
      commitish: "master",
      upload_assets: ["example_integration.ipa", "./pkg/built.gem"]
    )
  end
end
